package com.lee.string;

import com.lee.eo.User;
import org.junit.Test;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class StringTest {

    @Test
    public void test() {
        String a = "123";
        String b = "123";
        String c = new String("123");
        String d = new String("123");
        System.out.println(a == b);
        System.out.println(a == c);
        System.out.println(c == d);
    }

    static int a = 0;
    int b = 1;

    static void testStatic() {
        System.out.println(a);
        System.out.println(new StringTest().b);
    }

    void testPublic() {
        System.out.println(a);
        System.out.println(b);
    }

    @Test
    public void test3() {
//        final String a = "";
//        a = "v";

        final User user = new User();
        user.setEmail("12312321");

    }


    @Test
    public void test4(){
        Integer date = 20200321;
        System.out.println("date.toString().substring(3, 5) = " + date.toString().substring(4, 6));
        System.out.println("date.toString().substring(5, 7) = " + date.toString().substring(6, 8));

        DateTimeFormatter yyyyMMdd = DateTimeFormatter.ofPattern("yyyyMMdd");
        LocalDate parse1 = LocalDate.parse(date.toString(), yyyyMMdd);
        System.out.println("parse1.getDayOfMonth() = " + parse1.getDayOfMonth());
        System.out.println("parse1.getMonth() = " + parse1.getMonth());
    }

    @Test
    public void test5(){
        int i = Integer.parseInt("000001");
        System.out.println("i = " + i);
    }

    @Test
    public void test6(){
        System.out.println("啊啊啊啊啊啊".matches("^[\\u4e00-\\u9fa5]{2,5}$"));
    }


}
